$.ajaxWithHelper = function (e) {
    $.requestAjax = function (e) {
        var o = {
            type: "post", dataType: "json", data: {}, async: !0, beforeSend: function () {
            }, success: function (e) {
            }, error: function (e, o, n) {
                console.log(o + "-" + n)
            }, complete: function () {
            }
        };
        $.extend(o, e), $.ajax({
            url: o.url,
            type: o.type,
            dataType: o.dataType,
            async: o.async,
            data: o.data,
            headers: o.headers,
            success: function (e) {
                if (200 == e.code) {
                    var n = e;
                    // var n = e.data;
                    o.success(n)
                } else {
                    swal("错误!", e.msg, {
                        icon : "error",
                        buttons: {
                            confirm: {
                                className : 'btn btn-danger'
                            }
                        },
                    });
                    o.error(e.msg)
                }
            },
            error: function (e, n, t) {
                console.log(e, n, t);
                o.error("请求失败")
            },
            beforeSend: function () {
                o.beforeSend()
            },
            complete: function () {
                o.complete()
            }
        })
    }
}(jQuery);